/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package conexion;

import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JTextField;

/**
 *
 * @author Duoc
 */
public class Utilidades {
    
    public  static void limpiar(JComponent obj)
    {
        Object [] componente;
        componente = obj.getComponents();
        for (Object c : componente) {
            if(c instanceof JTextField)
            {
                 JTextField current = (JTextField) c ;
                 current.setText("");
            }
            else
            {
                if(c instanceof JButton)
                {
                    JButton b = (JButton)c;
                    b.setText("");
                }
            }
        }
    }
    
    
    public  static void habilitar(JComponent obj, boolean sw)
    {
        Object [] componente;
        componente = obj.getComponents();
        for (Object c : componente) {
            if(c instanceof JTextField)
            {
                 ((JTextField)c).setEnabled(sw);
            }
            else
            {
                if(c instanceof JButton)
                {
                    ((JButton)c).setEnabled(sw);
                   
                }
            }
        }
    }
    
}
